package com.example.demo.infra.repository.impl;

import com.example.demo.api.dto.DepartmentDTO;
import com.example.demo.domain.entity.Department;
import com.example.demo.domain.repository.DepartmentRepository;
import com.example.demo.infra.mapper.DepartmentMapper;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class DepartmentRepositoryImpl implements DepartmentRepository {
    private final DepartmentMapper departmentMapper;

    public DepartmentRepositoryImpl(DepartmentMapper departmentMapper) {
        this.departmentMapper = departmentMapper;
    }

    @Override
    public Department getDepartment(Long departmentId) {
        return departmentMapper.getDepartment(departmentId);
    }

    @Override
    public List<Department> listDepartment() {
        return departmentMapper.listDepartment();
    }

    @Override
    public Integer countDepartmentLen() {
        return departmentMapper.countDepartmentLen();
    }

    @Override
    public Integer insertDepartment(DepartmentDTO departmentDTO) {
        return departmentMapper.insertDepartment(departmentDTO);
    }

    @Override
    public Integer removeDepartment(Long departmentId) {
        return departmentMapper.removeDepartment(departmentId);
    }

    @Override
    public Integer updateDepartment(DepartmentDTO departmentDTO) {
        return departmentMapper.updateDepartment(departmentDTO);
    }

    @Override
    public List<Department> listDepartmentByIdList(List<Long> departmentIds) {
        return departmentMapper.listDepartmentByIdList(departmentIds);
    }

    @Override
    public void insertByList(List<DepartmentDTO> departments) {
        departmentMapper.insertByList(departments);
    }
}
